package tp.pr1.mv;

public class Instruction {

	private Command command;
	private int parameter=0;
	
	public Instruction(Command command) {
		this.command = command;
	}
	
	public Instruction(Command command, int parameter) {
		this.command = command;
		this.parameter = parameter;
	}
	
	public boolean isValid() {
		boolean ok=false;
		if (this.command != null && this.parameter >= 0) {
			ok=true;
		}
		return ok;
	}

	public Command getCommand() {
		return command;
	}

	public int getParameter() {
		return parameter;
	}
	
	public String toString() {
		String cadena;
		if(this.command==command.PUSH || this.command==command.LOAD || this.command==command.STORE)
			cadena = this.getCommand() + " " + this.getParameter();
		else 
			cadena = this.getCommand()+" ";
		return cadena;
	}

}
